package geralNotaFiscal;

import org.nakedobjects.extended.Cardinality;
import org.nakedobjects.extended.CompositeAssociation;
import org.nakedobjects.extended.Entity;
import org.nakedobjects.extended.Way;
import org.nakedobjects.extended.CompositeAssociation.CompositeType;
import org.nakedobjects.object.AbstractNakedObject;

@Entity
public class ItemPedido extends AbstractNakedObject{
	
	@CompositeAssociation(
			cardinality = Cardinality.ManyToOne, 
			compositeType = CompositeType.Physical, 
			fieldRelatedName = "itenspedidos", 
			relatedWith = NotaFiscal.class, 
			way = Way.TwoWay 
			)
	private NotaFiscal notafiscal;
	
	public void setNotafiscal(NotaFiscal notafiscal) {
		this.notafiscal = notafiscal;
		objectChanged();
	}

	public NotaFiscal getNotafiscal() {
		resolve(notafiscal);
		return notafiscal;
	}

}
